/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CreateAppointmentPanel.java
 *
 * Created on Jul 12, 2011, 7:04:19 PM
 */
package panels;

import conn.EMIS4Connection;
import dao.AppointmentDao;
import dao.ClinicDao;
import dao.PersonDao;
import exec.NotFoundException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import obj.Clinic;
import util.LoggedInUser;

/**
 *
 * @author nknowles
 */
public class ViewAppointmentPanel extends javax.swing.JPanel {

  private static ViewAppointmentPanel instance;

  /** Creates new form CreateAppointmentPanel */
  public ViewAppointmentPanel() {
    initComponents();
    EMIS4Connection conn = EMIS4Connection.getInstance();
    int userID = LoggedInUser.getInstance().getUserID();
    conn.connect();

    // clinic combo box
    ClinicDao clinicDAO = new ClinicDao();
    Clinic clinic = new Clinic(userID);
    AppointmentDao appointmentDAO = new AppointmentDao();
    PersonDao personDAO = new PersonDao();

    try {
      //clinicDAO.load(conn.getConnection(), clinic);
      appointmentDAO.getObject(conn.getConnection(), userID);
    } catch (NotFoundException ex) {
      Logger.getLogger(ViewAppointmentPanel.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
      Logger.getLogger(ViewAppointmentPanel.class.getName()).log(Level.SEVERE, null, ex);
    }

    // date
    

    //appoint info;
  }

  public static ViewAppointmentPanel getInstance() {
    if (instance == null) {
      instance = new ViewAppointmentPanel();
    }
    return instance;
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel11 = new javax.swing.JLabel();
    jLabel12 = new javax.swing.JLabel();
    clinicField = new javax.swing.JLabel();
    doctorField = new javax.swing.JLabel();
    reasonField = new javax.swing.JLabel();
    symptomsField = new javax.swing.JLabel();
    medsField = new javax.swing.JLabel();
    patientIDField = new javax.swing.JLabel();
    editButton = new javax.swing.JButton();
    monthComboBox = new javax.swing.JComboBox();
    yearComboBox = new javax.swing.JComboBox();
    dayComboBox = new javax.swing.JComboBox();
    timeComboBox = new javax.swing.JComboBox();
    ampmComboBox = new javax.swing.JComboBox();
    refreshButton = new javax.swing.JButton();

    setLayout(new java.awt.GridBagLayout());

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24));
    jLabel1.setText("Member View Appointment");
    jLabel1.setName("jLabel1"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 7, 25);
    add(jLabel1, gridBagConstraints);

    jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel2.setLabelFor(clinicField);
    jLabel2.setText("Clinic:");
    jLabel2.setName("jLabel2"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel2, gridBagConstraints);

    jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel3.setText("Date:");
    jLabel3.setName("jLabel3"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel3, gridBagConstraints);

    jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel5.setLabelFor(reasonField);
    jLabel5.setText("Visit Reason:");
    jLabel5.setName("jLabel5"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel5, gridBagConstraints);

    jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel6.setLabelFor(symptomsField);
    jLabel6.setText("Symptoms:");
    jLabel6.setName("jLabel6"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel6, gridBagConstraints);

    jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel7.setLabelFor(doctorField);
    jLabel7.setText("Doctor:");
    jLabel7.setName("jLabel7"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel7, gridBagConstraints);

    jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel11.setLabelFor(medsField);
    jLabel11.setText("Medication:");
    jLabel11.setName("jLabel11"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel11, gridBagConstraints);

    jLabel12.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel12.setLabelFor(patientIDField);
    jLabel12.setText("Patient ID:");
    jLabel12.setName("jLabel12"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 0);
    add(jLabel12, gridBagConstraints);

    clinicField.setName("clinicField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(clinicField, gridBagConstraints);

    doctorField.setName("doctorField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(doctorField, gridBagConstraints);

    reasonField.setName("reasonField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(reasonField, gridBagConstraints);

    symptomsField.setName("symptomsField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(symptomsField, gridBagConstraints);

    medsField.setName("medsField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(medsField, gridBagConstraints);

    patientIDField.setName("patientIDField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(patientIDField, gridBagConstraints);

    editButton.setText("Edit");
    editButton.setName("editButton"); // NOI18N
    editButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        editButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.ipadx = 20;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(15, 0, 10, 15);
    add(editButton, gridBagConstraints);

    monthComboBox.setName("monthComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(monthComboBox, gridBagConstraints);

    yearComboBox.setName("yearComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(yearComboBox, gridBagConstraints);

    dayComboBox.setName("dayComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(dayComboBox, gridBagConstraints);

    timeComboBox.setName("timeComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(timeComboBox, gridBagConstraints);

    ampmComboBox.setName("ampmComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    add(ampmComboBox, gridBagConstraints);

    refreshButton.setText("Refresh");
    refreshButton.setName("refreshButton"); // NOI18N
    refreshButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        refreshButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(15, 0, 10, 100);
    add(refreshButton, gridBagConstraints);
  }// </editor-fold>//GEN-END:initComponents

    private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
      // TODO add handling code for REFRESH
    }//GEN-LAST:event_refreshButtonActionPerformed

    private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
      // TODO add handling code for EDIT
    }//GEN-LAST:event_editButtonActionPerformed
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JComboBox ampmComboBox;
  private javax.swing.JLabel clinicField;
  private javax.swing.JComboBox dayComboBox;
  private javax.swing.JLabel doctorField;
  private javax.swing.JButton editButton;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel11;
  private javax.swing.JLabel jLabel12;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JLabel jLabel5;
  private javax.swing.JLabel jLabel6;
  private javax.swing.JLabel jLabel7;
  private javax.swing.JLabel medsField;
  private javax.swing.JComboBox monthComboBox;
  private javax.swing.JLabel patientIDField;
  private javax.swing.JLabel reasonField;
  private javax.swing.JButton refreshButton;
  private javax.swing.JLabel symptomsField;
  private javax.swing.JComboBox timeComboBox;
  private javax.swing.JComboBox yearComboBox;
  // End of variables declaration//GEN-END:variables
}
